package cn.sdormitory.controller.school;

import cn.sdormitory.common.api.CommonPage;
import cn.sdormitory.common.api.CommonResult;
import cn.sdormitory.school.entity.SchoolPatrol;
import cn.sdormitory.school.service.SchoolPatrolService;
import cn.sdormitory.smartclass.service.ClassDvService;
import cn.sdormitory.smartclass.vo.ClassDvVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Api(tags = "School-DvInfo=> 校园巡查")
@RequestMapping("/school/patrol")
public class SchoolPatrolController {

    @Autowired
    private SchoolPatrolService schoolPatrolService;

    @ApiOperation("getClassDvPageList => 分页查询巡查信息")
    @PreAuthorize("@ss.hasPermi('school:patrol:query')")
    @PostMapping(value = "/getPatrolPageList")
    public CommonResult<CommonPage<SchoolPatrol>> getPatrolPageList(@RequestBody Map<String, Object> params){
        CommonPage<SchoolPatrol> pageList = schoolPatrolService.getPage(params);
        return CommonResult.success(pageList);
    }

    @GetMapping("getSchoolPatrol/{id}")
    public CommonResult<SchoolPatrol> getSchoolPatrolById(@PathVariable("id")Long id){
        SchoolPatrol schoolPatrol = schoolPatrolService.getSchoolPatrolDetails(id);
        return CommonResult.success(schoolPatrol);
    }
}
